﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace cpe.cpein.SERVER.Tools
{
    /// <summary>
    /// 
    /// </summary>
    public static class UserSecurity
    {
        /// <summary>
        /// Allow to check in the DB if the user is connected.
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public static bool IsConnectUser(User user)
        {
            if (user != null && user.Id > 0 && user.IsDeleted == false)
            {
                var ids = from User in BUSINESS.BUUsers.GetConnectedUsers()
                          select User.usr_id;
                if (ids.Contains(user.Id))
                    return true;
            }
            return false;
        }
    }
}